<!--
 * @Author: ykp 501436989@qq.com
 * @Date: 2024-10-23 21:41:04
 * @LastEditors: ykp 501436989@qq.com
 * @LastEditTime: 2025-08-14 16:03:19
 * @FilePath: \vue-ts\src\views\system\components\input.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<script setup lang="ts">
import { ref, getCurrentInstance, nextTick,defineExpose,Ref, onMounted,inject,defineProps , toRefs} from "vue";
const $emit = defineEmits(['myEvent'])

// const props = defineProps(['parentData'])
const props = defineProps({
    parentData:{
        type:Number,
        default:0,

    }
})
const {parentData} = toRefs(props)
let name = ref<string>('数量')
let unit = ref<string>('个')
const goEmpty = ()=>{
    $emit("myEvent",0)
}
const goUnit = (e:string)=>{
    unit.value = e
    console.log(e,'goUnit')
    // $emit("myEvent",0)
}
defineExpose({
	unit,
    goUnit
})
interface Person {
    showType?: string,
    myEvent?: Function
  
}
const {showType,myEvent} = inject(/* 注入名 */"showType",{showType:false,myEvent:(e:string)=>{}})
// console.log(showType.value ,"showType")
myEvent('wwww')
</script>
<template>
    <div class="">
   {{ name }}
   {{ parentData }}{{  unit}}
   <el-button @click="goEmpty">清空数量</el-button>
    </div>
</template>

<style scoped lang="scss">

</style>
